package com.aspose.cells;

class zapg {
   private zapy a;
   private zcfw b;
   private static final com.aspose.cells.b.c.a.za c = new com.aspose.cells.b.c.a.za(new String[]{"page-layout", "style", "name", "page-layout-properties", "header-style", "footer-style", "page-width", "page-height", "num-format", "print-orientation", "margin-top", "margin-bottom", "margin-left", "margin-right", "first-page-number", "scale-to", "scale-to-X", "scale-to-Y", "table-centering", "writing-mode", "print", "print-page-order", "both", "horizontal", "vertical", "annotations", "charts", "drawings", "objects", "headers", "grid", "header-footer-properties", "min-height", "family", "text-properties", "font-name", "font-weight", "font-style", "text-line-through-style", "font-size", "color", "text-underline-style", "text-underline-type", "text-position"});

   zapg(zapy var1) {
      this.a = var1;
   }

   void a(zcfw var1) throws Exception {
      this.b = var1;
      if (var1.n()) {
         var1.a();
      } else {
         var1.d();

         while(zass.a(var1)) {
            switch(c.a(var1.p().toLowerCase())) {
            case 0:
               this.a();
               break;
            case 1:
               this.b();
               break;
            default:
               var1.a();
            }
         }

      }
   }

   private void a() throws Exception {
      zaqc var1 = new zaqc();
      if (this.b.n()) {
         this.b.a();
      } else {
         if (this.b.m()) {
            while(this.b.l()) {
               switch(c.a(this.b.p())) {
               case 2:
                  var1.a = this.b.s();
               }
            }

            this.b.k();
         }

         if (var1.a == null) {
            this.b.a();
         } else {
            this.a.o.a.put(var1.a, var1);
            this.b.d();

            while(zass.a(this.b)) {
               switch(c.a(this.b.p().toLowerCase())) {
               case 3:
                  this.a(var1);
                  break;
               case 4:
                  this.a(var1, true);
                  break;
               case 5:
                  this.a(var1, false);
                  break;
               default:
                  this.b.a();
               }
            }

         }
      }
   }

   private void a(zaqc var1) throws Exception {
      boolean var2 = false;
      if (this.b.m()) {
         label78:
         while(true) {
            if (!this.b.l()) {
               this.b.k();
               break;
            }

            switch(c.a(this.b.p())) {
            case 6:
               var2 = true;
               var1.c = zaqh.d(this.a.a, this.b.s()) / 72.0D;
               break;
            case 7:
               var2 = true;
               var1.d = zaqh.d(this.a.a, this.b.s()) / 72.0D;
               break;
            case 8:
               var1.e = com.aspose.cells.b.a.zo.a(this.b.s());
               break;
            case 9:
               var1.f = "portrait".equals(this.b.s().toLowerCase()) ? 1 : 0;
               break;
            case 10:
               var1.g = zaqh.d(this.a.a, this.b.s()) / 72.0D;
               break;
            case 11:
               var1.i = zaqh.d(this.a.a, this.b.s()) / 72.0D;
               break;
            case 12:
               var1.h = zaqh.d(this.a.a, this.b.s()) / 72.0D;
               break;
            case 13:
               var1.j = zaqh.d(this.a.a, this.b.s()) / 72.0D;
               break;
            case 14:
               if (zapb.b(this.b.s())) {
                  var1.o = com.aspose.cells.b.a.zo.a(this.b.s());
                  var1.p = false;
               } else {
                  var1.p = true;
               }
               break;
            case 15:
               var1.q = true;
               String var3 = this.b.s();
               if (var3.endsWith("%")) {
                  var3 = var3.substring(0, 0 + (var3.length() - 1));
               }

               var1.r = zaqh.k(var3);
               break;
            case 16:
               var1.q = false;
               var1.t = (double)com.aspose.cells.b.a.zo.a(this.b.s());
               break;
            case 17:
               var1.q = false;
               var1.s = (double)com.aspose.cells.b.a.zo.a(this.b.s());
               break;
            case 18:
               switch(c.a(this.b.s())) {
               case 22:
                  var1.u = true;
                  var1.v = true;
                  break;
               case 23:
                  var1.u = true;
                  break;
               case 24:
                  var1.v = true;
               }
            case 19:
            default:
               break;
            case 20:
               String var4 = this.b.s();
               String[] var5 = com.aspose.cells.b.a.zv.d(var4, ' ');
               int var6 = 0;

               while(true) {
                  if (var6 >= var5.length) {
                     continue label78;
                  }

                  switch(c.a(var5[var6])) {
                  case 25:
                     var1.A = true;
                     break;
                  case 26:
                  case 27:
                  case 28:
                     var1.z = false;
                     break;
                  case 29:
                     var1.x = true;
                     break;
                  case 30:
                     var1.y = true;
                  }

                  ++var6;
               }
            case 21:
               var1.w = "ltr".equals(this.b.s()) ? 1 : 0;
            }
         }
      }

      if (var2) {
         var1.a();
      }

      this.b.a();
   }

   private void a(zaqc var1, boolean var2) throws Exception {
      if (this.b.n()) {
         this.b.a();
      } else {
         this.b.d();

         while(zass.a(this.b)) {
            switch(c.a(this.b.p())) {
            case 31:
               this.b(var1, var2);
               break;
            default:
               this.b.a();
            }
         }

      }
   }

   private void b(zaqc var1, boolean var2) throws Exception {
      if (this.b.m()) {
         while(true) {
            if (!this.b.l()) {
               this.b.k();
               break;
            }

            switch(c.a(this.b.p())) {
            case 10:
               if (!var2) {
                  var1.n = zaqh.d(this.a.a, this.b.s()) / 72.0D;
               }
               break;
            case 11:
               if (var2) {
                  var1.m = zaqh.d(this.a.a, this.b.s()) / 72.0D;
               }
               break;
            case 32:
               if (var2) {
                  var1.k = zaqh.d(this.a.a, this.b.s()) / 72.0D;
               } else {
                  var1.l = zaqh.d(this.a.a, this.b.s()) / 72.0D;
               }
            }
         }
      }

      this.b.a();
   }

   private void b() throws Exception {
      String var1 = null;
      String var2 = null;
      if (this.b.m()) {
         while(true) {
            if (!this.b.l()) {
               this.b.k();
               break;
            }

            switch(c.a(this.b.p())) {
            case 2:
               var2 = this.b.s();
               break;
            case 33:
               var1 = this.b.s();
            }
         }
      }

      if (var1 != null && "text".equals(var1) && !this.b.n()) {
         Font var3 = new Font(this.a.b.getWorksheets(), (Object)null, false);
         this.a.o.b.put(var2, var3);
         this.b.d();

         while(zass.a(this.b)) {
            switch(c.a(this.b.p())) {
            case 34:
               this.a(var3);
               break;
            default:
               this.b.a();
            }
         }

      }
   }

   private void a(Font var1) throws Exception {
      if (this.b.m()) {
         String var2 = null;
         String var3 = null;

         while(this.b.l()) {
            switch(c.a(this.b.p().toLowerCase())) {
            case 35:
               if (this.a.q.get(this.b.s()) != null) {
                  var1.b((String)this.a.q.get(this.b.s()));
               } else {
                  var1.b(this.b.s());
               }
               break;
            case 36:
               var1.setBold("bold".equals(this.b.s().toLowerCase()));
               break;
            case 37:
               var1.setItalic("italic".equals(this.b.s().toLowerCase()));
               break;
            case 38:
               var1.setStrikeout("solid".equals(this.b.s().toLowerCase()));
               break;
            case 39:
               var1.setDoubleSize(zaqh.d(this.a.a, this.b.s()));
               break;
            case 40:
               var1.setColor(zaqh.h(this.b.s()));
               break;
            case 41:
               var2 = this.b.s();
               break;
            case 42:
               var3 = this.b.s();
               break;
            case 43:
               int var4 = this.b.s().indexOf(32);
               if (var4 != -1 && !this.b.s().equals("0% 100%")) {
                  String[] var5 = com.aspose.cells.b.a.zv.d(this.b.s(), ' ');
                  if (var5.length >= 2) {
                     boolean var6 = var5[0].charAt(0) == '-';
                     if (var6) {
                        var1.setSubscript(true);
                     } else {
                        var1.setSuperscript(true);
                     }
                  }
               }
            }

            if (var2 != null && "solid".equals(var2)) {
               var1.setUnderline(1);
               if ("double".equals(var2)) {
                  var1.setUnderline(2);
               }
            }
         }

         this.b.k();
      }

      this.b.a();
   }
}
